update([],[]).
update([H1 | T1],[H2 | T2]):-
    1 is mod(H1, 2),
    H2 = 'a',
    update(T1,T2).
update([H1 | T1],[H2 | T2]):-
    0 is mod(H1, 2),
    H2 = 'b',
    update(T1,T2).
update([1,2,3,4],1, X).

# modify Update
 update([H|T], Num, _):-
    length([H|T], Length),
    Length =< Num,
    !, fail.
 update([_|T], 0, update, [Update | T ]:-!.
 update([H | T1], Index, update, [H | T2]):-
    Index_next is Index - 1,
    update(T1, Index_next, T2).

#update([1,2,3,4],1,'LOL',X).